class UsersController < ResourceController
  def index
    @users = User.find(:all)
  end
  
  def show
    @topics = Topic.find_recent(:conditions => ['user_id=?', @user.id], :limit => 10)
  end
  
  # render new
  
  def create
    if @user.save
      session[:user_id] = @user.id
      flash[:notice] = "Successfully registered"
      redirect_to home_path
    else
      render :action => 'new'
    end
  end
  
  # render edit
  
  def update
    # RESEARCHME Why is "kind" protected from mass assignment?
    @user.kind = params[:user][:kind] unless params[:user][:kind].blank?
    if @user.save
      flash[:notice] = "Successfully updated profile"
      redirect_to user_path(@user)
    else
      render :action => 'edit'
    end
  end

end
